const path = require("path");
const webpack = require("webpack");

const resolve = dir => {
  return path.join(__dirname, dir);
};
const BASE_URL = process.env.NODE_ENV === "production" ? "/" : "/";
// vue.config.js
module.exports = {
  lintOnSave: true,
  publicPath: BASE_URL,
  outputDir: "dist",
  productionSourceMap: false,

  configureWebpack: {
    plugins: [
      new webpack.ProvidePlugin({
        $: "jquery",
        jQuery: "jquery",
        "windows.jQuery": "jquery",
        Popper: ["popper.js", "default"]
      })
    ]
  },

  chainWebpack: config => {
    config.resolve.alias
      .set("@$", resolve("src"))
      .set("@com", resolve("src/components"))
      .set("@api", resolve("src/api"))
      .set("@assets", resolve("src/assets"))
      .set("@layout", resolve("src/layout"))
      .set("@static", resolve("src/static"))
      .set("@pages", resolve("src/pages"));
  },
  devServer: {
    proxy: {
      "/api": {
        target: "",
        ws: false,
        changeOrigin: true
      }
    }
  }
};
